package com.wsd.bookkeeping.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;


/**
 * 消费或收入记录
 */
@Data
@TableName("t_record")
public class Record {

    @NotNull
    @TableId(value = "id", type = IdType.AUTO)
    public Integer id;

    @NotNull
    @TableField("book_id")
    public Integer bookId;

    @NotNull
    @TableField("user_id")
    public Integer userId;

    @NotNull
    @TableField("record_amount")
    public BigDecimal recordAmount;

    @TableField("record_comment")
    public String recordComment;

    @NotNull
    @TableField("style_id")
    public Integer styleId;

    @NotNull
    @TableField("style_name")
    public String styleName;

    @TableField("create_date")
    public String createDate;

    @TableField("update_date")
    public String updateDate;

    @TableField("record_type")
    public String recordType;

    @TableField(value = "secret_status", fill = FieldFill.INSERT)
    public String secretStatus;

    public static Record getSecretInstance(Integer id, Boolean status) {
        Record record = new Record();
        record.setId(id);
        record.setSecretStatus(status ? "1" : "0");
        return record;
    }
}
